home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- BackColor = &H00C0C0C0&
- Caption = "Webster Client"
- ClientHeight = 3105
- ClientLeft = 1140
- ClientTop = 1500
- ClientWidth = 4305
- Height = 3510
- Left = 1080
- LinkTopic = "Form1"
- ScaleHeight = 3105
- ScaleWidth = 4305
- Top = 1155
- Width = 4425
- Begin TextBox tWord
- Height = 285
- Left = 720
- TabIndex = 3
- Text = "webster"
- Top = 120
- Width = 2175
- End
- Begin TextBox tDesc
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 2535
- Left = 0
- MultiLine = -1 'True
- TabIndex = 2
- Top = 480
- Width = 4215
- End
- Begin CommandButton bLookUp
- Caption = "Look Up!!"
- Default = -1 'True
- Height = 315
- Left = 3000
- TabIndex = 1
- Top = 105
- Width = 1215
- End
- Begin IPPORT IPPort1
- EOL = ""
- Height = 420
- InBufferSize = 2048
- KeepAlive = 0 'False
- Left = 3000
- Linger = -1 'True
- LocalPort = 0
- MaxLineLength = 2048
- OutBufferSize = 2048
- RegHandle = WEBSTER.FRX:0000
- RemoteHost = ""
- RemotePort = 0
- Top = 0
- Width = 420
- WinsockLoaded = 0 'False
- End
- Begin Label Label1
- BackStyle = 0 'Transparent
- Caption = "WORD:"
- Height = 255
- Left = 30
- TabIndex = 0
- Top = 150
- Width = 615
- End
- Sub bLookUp_Click ()
- IPPort1.WinsockLoaded = True
- IPPort1.EOL = Chr$(10)
- 'close old connections (if any)
- If IPPort1.Connected Then IPPort1.Connected = False
- 'set the remote host
- tDesc.Text = "Looking up host citi.umich.edu..."
- IPPort1.RemoteHost = "citi.umich.edu"
- IPPort1.RemotePort = 2627
- 'attempt connection
- tDesc.Text = "Connecting to " & IPPort1.RemoteHost & "... "
- IPPort1.Connected = True
- 'wait until the connection is achieved
- '(timeout in 10 seconds)
- After10Seconds = Now + 10# / (3600# * 24#)
- Do Until Now > After10Seconds
- If IPPort1.Connected Then Exit Do
- DoEvents
- If Not IPPort1.Connected Then
- MsgBox "Connection timed out."
- tDesc.Text = ""
- Exit Sub
- End If
- 'send the data
- IPPort1.DataToSend = "DEFINE " & tWord & Chr$(10)
- End Sub
- Sub Form_Load ()
- tDesc = "This is a very simple Webster client." & Chr$(13) & Chr$(10)
- tDesc = tDesc & "It connects to a dictionary on the net." & Chr$(13) & Chr$(10)
- tDesc = tDesc & "You can enter text above, or just" & Chr$(13) & Chr$(10)
- tDesc = tDesc & "doubleclick a word here."
- End Sub
- Sub Form_Resize ()
- If WindowState <> 1 Then
- margin% = tDesc.Left
- tDesc.Width = ScaleWidth - 2 * margin%
- tDesc.Height = ScaleHeight - tDesc.Top - margin%
- End If
- End Sub
- Sub IPPort1_Connected (StatusCode As Integer, Description As String)
- tDesc.SelStart = Len(tDesc.Text)
- If StatusCode <> 0 Then
- tDesc.SelText = "Connection failed: " & Description & Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10)
- tDesc = ""
- End If
- End Sub
- Sub IPPort1_DataIn (Text As String, EOL As Integer)
- tDesc.SelStart = Len(tDesc.Text)
- tDesc.SelText = Text & Chr$(13) & Chr$(10)
- End Sub
- Sub IPPort1_Disconnected (StatusCode As Integer, Description As String)
- tDesc.SelStart = 0
- End Sub
- Sub tDesc_DblClick ()
- tWord = Trim$(tDesc.SelText)
- bLookUp = True
- 'select word
- tWord.SelStart = 0
- tWord.SelLength = Len(tWord)
- tWord.SetFocus
- End Sub
-